<!DOCTYPE HTML>
<html lang="zh" xmlns:th="http://www.thymeleaf.org">
<meta charset="utf-8">
<head th:include="include :: header"></head>
<body class="white-bg">
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
    <form class="form-horizontal m" id="form-salary-add">
        <div class="col-md-6">
            <div class="form-group">
                <label class="col-sm-3 control-label">变动用户：</label>
                <div class="col-sm-8">
                    <input id="userId" name="userId" type="hidden">
                    <input id="userName" name="userName" class="form-control" onclick="selectUserTree()" type="text" readonly>
                </div>
            </div>
        </div>
        <div class="col-md-6">
            <div class="form-group">
                <label class="col-sm-3 control-label">归属部门：</label>
                <div class="col-sm-8">
                    <input class="form-control" type="text" name="deptName" onclick="selectDeptTree()" readonly="true" id="treeName">
                    <input name="officeId"  type="hidden" id="treeId"/>
                </div>
            </div>
        </div>
        <div class="col-md-6">
            <div class="form-group">
                <label class="col-sm-3 control-label">岗位：</label>
                <div class="col-sm-8">
                    <select name="post" id="post" class="form-control select2-hidden-accessible">
                        <option th:each="post:${posts}" th:value="${post.postId}" th:text="${post.postName}" th:disabled="${post.status == '1'}"></option>
                    </select>
                </div>
            </div>
        </div>
        <div class="col-md-6">
            <div class="form-group">
                <label class="col-sm-3 control-label">用户性别：</label>
                <div class="col-sm-8">
                    <select id="sex" class="form-control m-b" th:with="type=${@dict.getType('sys_user_sex')}">
                        <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
                    </select>
                </div>
            </div>
        </div>
        <div class="col-md-6">
            <div class="form-group">
                <label class="col-sm-3 control-label">学历：</label>
                <div class="col-sm-8">
                    <input id="edu" name="edu" class="form-control" type="text">
                </div>
            </div>
        </div>
        <div class="col-md-6">
            <div class="form-group">
                <label class="col-sm-3 control-label">调整原因：</label>
                <div class="col-sm-8">
                    <input id="content" name="content" class="form-control" type="text">
                </div>
            </div>
        </div>
        <div class="col-md-6">
            <div class="form-group">
                <label class="col-sm-3 control-label">现行标准 薪酬档级：</label>
                <div class="col-sm-8">
                    <input id="olda" name="olda" class="form-control" type="text">
                </div>
            </div>
        </div>
        <div class="col-md-6">
            <div class="form-group">
                <label class="col-sm-3 control-label">调整后标准 薪酬档级：</label>
                <div class="col-sm-8">
                    <input id="newa" name="newa" class="form-control" type="text">
                </div>
            </div>
        </div>
        <div class="col-md-6">
            <div class="form-group">
                <label class="col-sm-3 control-label">现行标准 月工资额：</label>
                <div class="col-sm-8">
                    <input id="oldb" name="oldb" class="form-control" type="text">
                </div>
            </div>
        </div>
        <div class="col-md-6">
            <div class="form-group">
                <label class="col-sm-3 control-label">调整后标准 月工资额：</label>
                <div class="col-sm-8">
                    <input id="newb" name="newb" class="form-control" type="text">
                </div>
            </div>
        </div>
        <div class="col-md-6">
            <div class="form-group">
                <label class="col-sm-3 control-label">现行标准 年薪总额：</label>
                <div class="col-sm-8">
                    <input id="oldc" name="oldc" class="form-control" type="text">
                </div>
            </div>
        </div>
        <div class="col-md-6">
            <div class="form-group">
                <label class="col-sm-3 control-label">调整后标准 年薪总额：</label>
                <div class="col-sm-8">
                    <input id="newc" name="newc" class="form-control" type="text">
                </div>
            </div>
        </div>
        <div class="col-md-6">
            <div class="form-group">
                <label class="col-sm-3 control-label">执行时间：</label>
                <div class="col-sm-8">
                    <input id="exeDate" name="exeDate" class="form-control time-input" type="text">
                </div>
            </div>
        </div>
        <div class="col-md-6">
            <div class="form-group">
                <label class="col-sm-3 control-label">月增资：</label>
                <div class="col-sm-8">
                    <input id="addNum" name="addNum" class="form-control" type="text">
                </div>
            </div>
        </div>
        <div class="form-group">
            <div class="form-control-static col-sm-offset-9">
                <button type="submit" class="btn btn-primary">提交</button>
                <button type="button" class="btn btn-danger" onclick="$.modal.close()">关闭</button>
            </div>
        </div>
    </form>
</div>
<div th:include="include::footer"></div>
<script th:src="@{/ajax/libs/select/select2.js}"></script>
<script type="text/javascript">
    var prefix = ctx + "activiti/salary";

    $("#form-salary-add").validate({
        rules: {
            userName: {
                required: true,
            },
        }
    });
    function submitHandler() {
        if ($.validate.form()) {
            $.operate.save(prefix + "/add", $('#form-salary-add').serialize());
        }
    }
    /*用户管理-新增-选择用户*/
    function selectUserTree() {
        var url = ctx + "system/user/userTree";
        $.modal.open("选择通知人", url);
    }
    function loadUser(userId,userName) {
        $("#userName").val(userName);
        $("#userId").val(userId);
    }

    /*用户管理-新增-选择部门树*/
    function selectDeptTree() {
        var treeId = $("#treeId").val();
        var deptId = $.common.isEmpty(treeId) ? "100" : $("#treeId").val();
        var url = ctx + "system/dept/selectDeptTree/" + deptId;
        var options = {
            title: '选择部门',
            width: "380",
            url: ctx + "system/dept/selectDeptTree/" + deptId,
            callBack: doSubmit
        };
        $.modal.openOptions(options);
    }

    function doSubmit(index, layero){
        var tree = layero.find("iframe")[0].contentWindow.$._tree;
        if ($.tree.notAllowParents(tree)) {
            var body = layer.getChildFrame('body', index);
            $("#treeId").val(body.find('#treeId').val());
            $("#treeName").val(body.find('#treeName').val());
            layer.close(index);
        }
    }
</script>
</body>
</html>